import { createRouter,createWebHashHistory }from "vue-router"
import Index from '../pages/Index.vue'
import User from '../pages/User.vue'
import Cart from '../pages/Cart.vue'
import Product from '../pages/Product.vue'
import Category from '../pages/Product.vue'
const router=createRouter({
    history:createWebHashHistory(),
    routes:[
        {path:'/',redirect:"/index",meta:{title:'首页'}},
        {path:'/index',component:Index,meta:{title:'首页'}},
        {path:'/user',component:User,meta:{title:'个人中心'}},
        {path:'/cart',component:Cart,meta:{title:'购物车'}},
        {path:'/product',component:Product,meta:{title:'商品详细'}},
        {path:'/category',component:Category,meta:{title:'商品分类'}},
        
    ],
    linkActiveClass:'active'
})
router.beforeEach((to,from,next)=>{
    document.title=to.meta.title;
    next()
})
export default router